<template>
  <view :class="`hb-flex hb-gap-3 hb-items-center hb-p-2`" :style="{ justifyContent: justify }">
    <tm-icon
      v-if="refreshable"
      name="ali-icon icon-refresh"
      :font-size="32"
      color="#2878FF"
      @click="emit('resend')"
    ></tm-icon>
    <tm-icon
      name="ali-icon icon-fuzhi"
      color="#2878FF"
      :font-size="32"
      @click="handleCopy"
    ></tm-icon>
  </view>
</template>

<script lang="ts" setup>
  const props = withDefaults(
    defineProps<{
      justify?: string;
      refreshable?: boolean;
      content?: string;
    }>(),
    {
      justify: 'start',
      refreshable: true,
      content: '',
    },
  );

  const emit = defineEmits<{
    (e: 'resend'): void;
    (e: 'copy'): void;
  }>();

  const handleCopy = () => {
    uni.setClipboardData({
      data: props.content,
    });
  };
</script>

<style></style>
